// import dashboard from './modules/dashboard';
import BasicLayout from '@/layouts/basic-layout';

/**
 * 在主框架内显示
 */

const frameIn = [
    {
        path: '/',
        redirect: {
            name: 'index'
        },
        component: BasicLayout,
        children: [
            {
                path: 'index',
                name: 'index',
                meta: {
                    title: '人事管理系统',
                    auth: true,
                    closable: false
                },
                component: () => import('@/pages/index')
            },
            /* {
                path: 'tabs/examinee',
                name: 'examinee',
                meta: {
                    title: '管理员管理',
                    auth: ['admin'],
                    closable: false
                },
                component: () => import('@/pages/tabs/examinee/index')
            },
            {
                path: 'tabs/examineeInfo',
                name: 'examineeInfo',
                meta: {
                    title: '考生信息',
                    auth: ['admin'],
                    closable: false
                },
                component: () => import('@/pages/tabs/examinee/component/examineeInfo')
            },
            {
                path: 'tabs/examiner',
                name: 'examiner',
                meta: {
                    title: '考务人员管理',
                    auth: ['admin'],
                    closable: false
                },
                component: () => import('@/pages/tabs/examiner/index')
            },
            ,
            {
                path: 'tabs/examinerInfo',
                name: 'examinerInfo',
                meta: {
                    title: '考务人员信息',
                    auth: ['admin'],
                    closable: false
                },
                component: () => import('@/pages/tabs/examiner/component/examinerInfo')
            },
            {
                path: 'tabs/',
                redirect: {
                    name: 'project'
                },
                component: ()=> import('@/pages/tabs/common/viewMiddleware'),
                children: [
                    {
                        path: 'project',
                        name: 'project',
                        meta: {
                            title: '考务项目管理',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/index')
                    },
                    {
                        path: 'project/setnotice',
                        name: 'setnotice',
                        meta: {
                            title: '公告设置',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/setnotice')
                    },
                    {
                        path: 'project/setProjectFlow',
                        name: 'setProjectFlow',
                        meta: {
                            title: '项目流程设置',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/setProjectFlow')
                    },
                    {
                        path: 'project/setstation',
                        name: 'setstation',
                        meta: {
                            title: '岗位设置',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/setstation')
                    },
                    {
                        path: 'project/applyCheck',
                        name: 'applyCheck',
                        meta: {
                            title: '报名审查',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/applyCheck')
                    },
                    {
                        path: 'project/admissionTicket',
                        name: 'admissionTicket',
                        meta: {
                            title: '准考证',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/admissionTicket')
                    },
                    {
                        path: 'project/resultPublish',
                        name: 'resultPublish',
                        meta: {
                            title: '成绩公布',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/resultPublish')
                    },
                    {
                        path: 'project/interviewSign',
                        name: 'interviewSign',
                        meta: {
                            title: '面试签到',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/interviewSign')
                    },
                    {
                        path: 'project/Q_Asession',
                        name: 'Q_Asession',
                        meta: {
                            title: '考生问答',
                            auth: ['admin'],
                            closable: false
                        },
                        component: () => import('@/pages/tabs/examinationProject/project/Q_Asession')
                    }
                ]
            }, */
            // {
            //     path: 'log',
            //     name: 'log',
            //     meta: {
            //         title: '前端日志',
            //         auth: true
            //     },
            //     component: () => import('@/pages/system/log')
            // },
            // 刷新页面 必须保留
            {
                path: 'refresh',
                name: 'refresh',
                hidden: true,
                component: {
                    beforeRouteEnter (to, from, next) {
                        next(instance => instance.$router.replace(from.fullPath));
                    },
                    render: h => h()
                }
            },
            // 页面重定向 必须保留
            {
                path: 'redirect/:route*',
                name: 'redirect',
                hidden: true,
                component: {
                    beforeRouteEnter (to, from, next) {
                        next(instance => instance.$router.replace(JSON.parse(from.params.route)));
                    },
                    render: h => h()
                }
            }
        ]
    },
    {
        path: '/projectList',
        name: 'projectList',
        meta: {
            title: '项目列表',
            auth: ['user'],
            closable: false
        },
        component: () => import('@/pages/user/home/home')
    },
    ,
    {
        path: '/project',
        redirect: {
            name: 'notice'
        },
        meta: {
            title: '项目详情',
            auth: ['user']
        },
        component: () => import('@/pages/user/info/index'),
        children: [
            {
                path: '/project/notice',
                name: 'notice',
                meta: {
                    title: '招聘公告',
                    auth: ['user']
                },
                component: () => import('@/pages/user/info/tabs/notice'),
            },
            {
                path: '/project/schedule',
                name: 'schedule',
                meta: {
                    title: '当前进度',
                    auth: ['user']
                },
                component: () => import('@/pages/user/info/tabs/schedule'),
            },
            {
                path: '/project/postList',
                name: 'postList',
                meta: {
                    title: '岗位查看',
                    auth: ['user']
                },
                component: () => import('@/pages/user/info/tabs/postList'),
            },
            {
                path: '/project/userQ_Asession',
                name: 'userQ_Asession',
                meta: {
                    title: '考生问答',
                    auth: ['user']
                },
                component: () => import('@/pages/user/info/tabs/Q_Asession'),
            }
        ]
    }
    // dashboard
];

/**
 * 在主框架之外显示
 */

const frameOut = [
    // 登录
    {
        path: '/login',
        name: 'login',
        meta: {
            title: '$t:page.login.title'
        },
        component: () => import('@/pages/account/login')
    },
    // 注册
    {
        path: '/register',
        name: 'register',
        meta: {
            title: '$t:page.register.title'
        },
        component: () => import('@/pages/account/register')
    },
    // 注册结果
    {
        path: '/register/result',
        name: 'register-result',
        meta: {
            auth: true,
            title: '注册结果'
        },
        component: () => import('@/pages/account/register/result')
    }
];

/**
 * 错误页面
 */

const errorPage = [
    {
        path: '/403',
        name: '403',
        meta: {
            title: '403'
        },
        component: () => import('@/pages/system/error/403')
    },
    {
        path: '/500',
        name: '500',
        meta: {
            title: '500'
        },
        component: () => import('@/pages/system/error/500')
    },
    /* {
        path: '*',
        name: '404',
        meta: {
            title: '404'
        },
        component: () => import('@/pages/system/error/404')
    } */
];

// 导出需要显示菜单的
export const frameInRoutes = frameIn;

// 重新组织后导出
export default [
    ...frameIn,
    ...frameOut,
    ...errorPage
];
